package com.js.rtu.adapter;

import android.bluetooth.BluetoothDevice;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by wz on 2020/12/14.
 */
public class DeviceBean implements Parcelable {
   private BluetoothDevice device;
    int rssi;
    private boolean isConntect=false;
    public DeviceBean(BluetoothDevice pDevice, int pRssi) {
        device = pDevice;

        rssi = pRssi;
    }

    protected DeviceBean(Parcel in) {
        device = in.readParcelable(BluetoothDevice.class.getClassLoader());
        rssi = in.readInt();
    }

    public static final Creator<DeviceBean> CREATOR = new Creator<DeviceBean>() {
        @Override
        public DeviceBean createFromParcel(Parcel in) {
            return new DeviceBean(in);
        }

        @Override
        public DeviceBean[] newArray(int size) {
            return new DeviceBean[size];
        }
    };

    public BluetoothDevice getDevice() {
        return device;
    }

    public void setDevice(BluetoothDevice pDevice) {
        device = pDevice;
    }

    public int getRssi() {
        return rssi;
    }

    public void setRssi(int pRssi) {
        rssi = pRssi;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeParcelable(device, i);
        parcel.writeInt(rssi);
    }

    public boolean isConntect() {
        return isConntect;
    }

    public void setConntect(boolean conntect) {
        isConntect = conntect;
    }
}
